home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1994 March / Internet Info CD-ROM (Walnut Creek) (March 1994).iso / inet / internet-drafts / draft-ietf-cat-ftpsec-01.txt < prev    next >
Text File  |  1993-04-22  |  37KB  |  870 lines

  1.  
  2.  
  3.  
  4. Network Working Group                    Internet Engineering Task Force
  5. Internet-Draft            Common Authentication Technology Working Group
  6. Updates: RFC 959                                              S. J. Lunt
  7.                                                                 Bellcore
  8.                                                               April 1993
  9.  
  10.  
  11.                         FTP Security Extensions
  12.  
  13. Status of this Memo
  14.  
  15.    This document is an Internet  Draft.   Internet  Drafts  are  working
  16.    documents  of  the Internet Engineering Task Force (IETF), its Areas,
  17.    and its Working Groups. Note that other groups  may  also  distribute
  18.    working documents as Internet Drafts.
  19.  
  20.    Internet Drafts are draft  documents  valid  for  a  maximum  of  six
  21.    months. Internet  Drafts  may  be  updated, replaced, or obsoleted by
  22.    other documents at any time.  It is not appropriate to  use  Internet
  23.    Drafts as reference material or to cite them other than as a "working
  24.    draft" or "work in progress."
  25.  
  26.    Please check the I-D abstract  listing  contained  in  each  Internet
  27.    Draft  directory  to  learn  the  current status of this or any other
  28.    Internet Draft.
  29.  
  30.    Distribution of this memo is unlimited.  Please send comments to  the
  31.    <ftp-wg@tgv.com> mailing list.
  32.  
  33. 1. Description
  34.  
  35.    This document defines extensions to the FTP  specification  RFC  959,
  36.    "FILE  TRANSFER  PROTOCOL (FTP)" (October 1985), which provide strong
  37.    authentication, integrity, and confidentiality on  both  the  control
  38.    and  data  channels  with  the introduction of new optional commands,
  39.    replies, and file transfer encodings.
  40.  
  41.    The  following  new  optional  commands  are   introduced   in   this
  42.    specification:
  43.  
  44.       AUTH  (Authentication  Type),  ADAT  (Authentication  Data),   MIC
  45.       (Integrity  Protected  Command),  ENC (Privacy Protected Command),
  46.       and PROT (Data Channel Protection Level).
  47.  
  48.    A new class of reply types (6yz) is  also  introduced  for  protected
  49.    replies.
  50.  
  51.  
  52.  
  53.  
  54. Expires: October 31, 1993                                       [Page 1]
  55.  
  56. Internet-Draft          FTP Security Extensions               April 1993
  57.  
  58.  
  59.    None of the above commands are required to be implemented,  but  each
  60.    is dependent on the other (except ENC, which is optional).
  61.  
  62.    Note that this specification is compatible with RFC 959.
  63.  
  64. 2. Motivation
  65.  
  66.    The File Transfer Protocol (FTP) currently defined in RFC 959 and  in
  67.    place  on  the  Internet  uses  usernames  and  passwords  passed  in
  68.    cleartext to authenticate clients to servers (via the USER  and  PASS
  69.    commands).   Except  for  services  such as 'anonymous' FTP archives,
  70.    this represents a security  risk  whereby  passwords  can  be  stolen
  71.    through monitoring of local and wide-area networks.  This either aids
  72.    potential  attackers  through   password   exposure   and/or   limits
  73.    accessibility of files to remote users who can or will not accept the
  74.    inherent security risk.
  75.  
  76.    Aside from the problem of authenticating users in  a  secure  manner,
  77.    there  is  also  the  problem  of  protecting  sensitive  data and/or
  78.    verifying its integrity.  An attacker may be able to access  valuable
  79.    or  sensitive  data merely by monitoring a network, or through active
  80.    means may be able to delete or modify the data being  transferred  so
  81.    as  to  corrupt  its integrity.  An active attacker may also initiate
  82.    spurious file transfers to and from a site of the attacker's  choice,
  83.    and  may invoke other commands on the server.  FTP does not currently
  84.    have  any  provision  for  the  encryption  or  verification  of  the
  85.    authenticity  of  commands,  replies, or transferred data.  Note that
  86.    these security services have value even to anonymous file access.
  87.  
  88.    Current practice for sending files securely is generally either:
  89.  
  90.  
  91.      1.  via FTP of files pre-encrypted under keys  which  are  manually
  92.          distributed,
  93.  
  94.      2.  via electronic mail containing an encoding of a file  encrypted
  95.          under keys which are manually distributed,
  96.  
  97.      3.  via a PEM message, or
  98.  
  99.      4.  via the rcp command enhanced to use Kerberos.
  100.  
  101.  
  102.    None of these means could be considered even a de facto standard, and
  103.    none are truly interactive.  A need exists to securely transfer files
  104.    using FTP in a secure  manner  which  is  supported  within  the  FTP
  105.    protocol in a consistent manner and which takes advantage of existing
  106.    security infrastructure and technology.  Extensions are necessary  to
  107.    the FTP specification if these security services are to be introduced
  108.    into the protocol in an interoperable way.
  109.  
  110.  
  111.  
  112. Expires: October 31, 1993                                       [Page 2]
  113.  
  114. Internet-Draft          FTP Security Extensions               April 1993
  115.  
  116.  
  117.    Although the FTP control connection follows the Telnet protocol,  and
  118.    Telnet  has  defined an authentication and encryption option [5], RFC
  119.    1123 [4] explicitly forbids the use of Telnet option negotiation over
  120.    the  control  connection (other than Synch and IP).  Also, the Telnet
  121.    authentication and encryption option does not provide  for  integrity
  122.    protection  only  (without confidentiality), and does not address the
  123.    protection of the data channel.
  124.  
  125. 3. New FTP Commands
  126.  
  127.    The following commands are optional, but  dependent  on  each  other.
  128.    They are extensions to the FTP Access Control Commands.
  129.  
  130.    AUTHENTICATION TYPE (AUTH)
  131.  
  132.       The argument field is a  Telnet  string  identifying  a  supported
  133.       authentication  mechanism.   The  command  represents a request to
  134.       perform  an  authentication  protocol   exchange   based   on   an
  135.       authentication  mechanism  identified by the argument.  Currently,
  136.       only KERBEROS_V4 and GSSAPI are defined.
  137.  
  138.       If the server accepts an authentication type with reply code  334,
  139.       then the client must next initiate an authentication exchange (via
  140.       the ADAT command) based on that authentication type.  The goal  of
  141.       the  authentication  exchange is to strongly authenticate the user
  142.       to the server, and to establish a security context [3] under which
  143.       protection of the control and data channels may be performed.
  144.  
  145.       If the server replies with a 234  code,  then  the  authentication
  146.       type  is  accepted,  and  no  ADAT commands are required.  This is
  147.       useful to indicate to the server that the password to be sent in a
  148.       subsequent  PASS  command  is  to  be interpreted differently than
  149.       normal, as in the case of  smart  cards  or  other  non-disclosing
  150.       password   systems.   Challenge  information  intended  for  human
  151.       interpretation may be contained in the  reply.   Such  information
  152.       may also be conveyed in the text of the reply to the USER command.
  153.  
  154.       If the server rejects a type (reply code 504), or any ADAT command
  155.       fails,  then  the  client  may  try another authentication type by
  156.       issuing another AUTH command, or may continue by sending USER  and
  157.       PASS  commands.   Thus,  the  client should request authentication
  158.       types in decreasing order of  preference  (i.e.,  strength).   The
  159.       server  will  reject  (with  a  503  reply  code) any AUTH or ADAT
  160.       commands  sent  after  an  authentication  protocol   successfully
  161.       completes.
  162.  
  163.       The client should not require  the  server  to  support  the  AUTH
  164.       command  or  any  particular  authentication  type.  If either the
  165.       server does not support the AUTH command (reply code 500), or  the
  166.       client  and  server  cannot agree on an authentication type, or no
  167.  
  168.  
  169.  
  170. Expires: October 31, 1993                                       [Page 3]
  171.  
  172. Internet-Draft          FTP Security Extensions               April 1993
  173.  
  174.  
  175.       authentication exchange succeeds, then the default USER  and  PASS
  176.       commands must be performed.
  177.  
  178.       The AUTH command will normally be the first command transmitted by
  179.       the  user after the control connections are made, generally before
  180.       the USER command.  However, the AUTH command may cause the control
  181.       connection  to be closed by servers which require the USER command
  182.       to be the first command transmitted by the user after the  control
  183.       connection is made.
  184.  
  185.       Some servers will require that authentication be performed  before
  186.       certain commands (including USER) will be accepted.  In this case,
  187.       a 530  reply  will  be  sent  indicating  that  an  authentication
  188.       exchange is required.
  189.  
  190.       Some authentication protocols may require prior knowledge  of  the
  191.       remote user name (e.g., some challenge/response systems).  In this
  192.       case, the USER command may be sent in advance of the AUTH command.
  193.  
  194.  
  195.    AUTHENTICATION DATA (ADAT)
  196.  
  197.       The argument field is a  Telnet  string  representing  a  base  64
  198.       encoded authentication data (see the definition of the MIC command
  199.       for a description of base 64 encoding).  The data is  specific  to
  200.       the  authentication protocol specified by a previous AUTH command.
  201.       The ADAT command, and the associated replies, allow the client and
  202.       server  to  conduct  an  arbitrary  authentication  protocol.  The
  203.       client will send authentication data to the server  via  the  ADAT
  204.       command,  and  the  server  will  send  authentication back to the
  205.       client by including "ADAT=string" in the reply,  where  string  is
  206.       also  a  Telnet string representing base 64 encoded authentication
  207.       data.  The server will reply 501 if the string could not  be  base
  208.       64 decoded.
  209.  
  210.       If the server sends a 535  reply,  then  the  authentication  data
  211.       could  not  be successfully processed, and the client has not been
  212.       authenticated.  The client may either try  another  authentication
  213.       type  by  sending  another AUTH command, or may send USER and PASS
  214.       commands.  The server will  reply  503  if  no  AUTH  command  was
  215.       previously accepted.
  216.  
  217.       If the server sends a 335 reply, then the authentication data  was
  218.       successfully  processed, but more authentication data is necessary
  219.       to complete the authentication process.  In this case, the  server
  220.       must include encoded authentication data in the reply.  The client
  221.       must process this  returned  data  and  then  issue  another  ADAT
  222.       command.
  223.  
  224.       If the server sends a  235  reply,  optionally  including  encoded
  225.  
  226.  
  227.  
  228. Expires: October 31, 1993                                       [Page 4]
  229.  
  230. Internet-Draft          FTP Security Extensions               April 1993
  231.  
  232.  
  233.       authentication   data,   then  the  server  considers  the  client
  234.       authenticated.  The client must process  any  authentication  data
  235.       present in the reply.
  236.  
  237.       Appendix I defines the actual protocol for KERBEROS_V4.   Appendix
  238.       II defines the actual protocol for GSSAPI.
  239.  
  240.       If an authentication exchange succeeds, then the client's identity
  241.       has  been  authenticated  but not yet authorized.  The client must
  242.       next invoke the USER command to identify to the server the account
  243.       (file  system) for which access is requested.  If the USER command
  244.       results in a 231 reply, then the  client  is  authorized,  and  no
  245.       password is required.  However, the client must then send the PASS
  246.       command to actually log  the  user  in  (the  actual  password  is
  247.       ignored and should be a dummy value).  If the USER command results
  248.       in a 333 reply,  then  the  user  was  not  authorized  without  a
  249.       password,  and  a password must be sent with the PASS command.  In
  250.       this case,  it  is  recommended  that  the  PASS  command  be  ENC
  251.       protected.   Additional  USER  or  PASS commands may be sent after
  252.       success of an ADAT command.
  253.  
  254.       Once the client is successfully authenticated via  AUTH  and  ADAT
  255.       commands,  the rest of the data over the control channel (commands
  256.       and replies) must  be  protected,  either  with  integrity  (by  a
  257.       cryptographic   checksum)   via   the   MIC   command,   or   with
  258.       confidentiality (by encryption) via the ENC  command.   (Also  see
  259.       Section  4  on  protected  replies.)  These  two  commands  may be
  260.       arbitrarily intermixed.  It is up to the client to decide which of
  261.       MIC  and  ENC  commands to use, and it is up to the server when to
  262.       accept either.  The server will return a 502 reply  to  any  other
  263.       command.   The  server  will  return  a  500 reply to a MIC or ENC
  264.       command if no ADAT command succeeded.
  265.  
  266.       Commands sent via the  Telnet  out-of-band  signal  must  also  be
  267.       protected.   That  is,  if  the client sends the Telnet "Interrupt
  268.       Process" (IP) signal followed by the Telnet "Synch"  signal,  then
  269.       the  command  sent  to the server immediately afterwards must also
  270.       protected.
  271.  
  272.       A requirement of all specifications for  authentication  exchanges
  273.       based  on  new  authentication  types  is  that they convey to the
  274.       caller whether encryption is supported on the  resultant  security
  275.       context,  since  it is not a requirement that the ENC command, 632
  276.       protected replies, or the Private protection level  be  supported.
  277.       It is also strongly suggested that per message protection services
  278.       supported by each mechanism perform  message  replay  and  out-of-
  279.       sequence  detection,  since  no  provision  for  these services is
  280.       explicitly made within this specification.
  281.  
  282.       Since no explicit provision is made in this specification for  the
  283.  
  284.  
  285.  
  286. Expires: October 31, 1993                                       [Page 5]
  287.  
  288. Internet-Draft          FTP Security Extensions               April 1993
  289.  
  290.  
  291.       negotiation  of  alternate  mechanisms  for performing per message
  292.       protection services, implementors should instead utilize the token
  293.       exchange for this purpose.
  294.  
  295.  
  296.    INTEGRITY PROTECTED COMMAND (MIC)
  297.  
  298.       The argument field is a Telnet string  consisting  of  a  base  64
  299.       encoded  "safe"  message  produced  by an authentication mechanism
  300.       specific message integrity procedure.  The server will decode  the
  301.       received  string,  verify  its  integrity  via  the authentication
  302.       mechanism specific message integrity procedure, and upon  success,
  303.       interpret  the  resultant  string  as  an  FTP command.  The user-
  304.       process need not include the Telnet end-of-line  code  within  the
  305.       encoded command.
  306.  
  307.       Base 64 encoding is the same as the Printable  Encoding  described
  308.       in Section 4.3.2.4 of [2] and is defined as follows.
  309.  
  310.       Proceeding from left to right, the bit string resulting  from  the
  311.       mechanism  specific  protection routine is encoded into characters
  312.       which are universally  representable  at  all  sites,  though  not
  313.       necessarily  with  the  same  bit  patterns  (e.g.,  although  the
  314.       character  "E"  is  represented  in  an  ASCII-based   system   as
  315.       hexadecimal  45  and  as hexadecimal C5 in an EBCDIC-based system,
  316.       the local significance of the two representations is equivalent).
  317.  
  318.       A 64-character subset  of  International  Alphabet  IA5  is  used,
  319.       enabling  6  bits to be represented per printable character.  (The
  320.       proposed subset of characters is represented  identically  in  IA5
  321.       and  ASCII.)  The  character  "="  signifies  a special processing
  322.       function used for padding within the printable encoding procedure.
  323.  
  324.       The encoding process represents 24-bit groups  of  input  bits  as
  325.       output  strings  of 4 encoded characters.  Proceeding from left to
  326.       right across a 24-bit input group extracted  from  the  output  of
  327.       step  3,  each 6-bit group is used as an index into an array of 64
  328.       printable characters, namely "[A-Z][a-z][0-9]+/".   The  character
  329.       referenced  by  the  index  is placed in the output string.  These
  330.       characters are selected so as to be universally representable, and
  331.       the set excludes characters with particular significance to Telnet
  332.       (e.g., "<CR>", "<LF>", IAC).
  333.  
  334.       Special  processing  is  performed  if  fewer  than  24  bits  are
  335.       available  in  an  input  group  at  the end of a message.  A full
  336.       encoding quantum is always completed at  the  end  of  a  message.
  337.       When  fewer  than  24  input bits are available in an input group,
  338.       zero bits are added (on the right) to form an integral  number  of
  339.       6-bit  groups.   Output character positions which are not required
  340.       to represent actual input data  are  set  to  the  character  "=".
  341.  
  342.  
  343.  
  344. Expires: October 31, 1993                                       [Page 6]
  345.  
  346. Internet-Draft          FTP Security Extensions               April 1993
  347.  
  348.  
  349.       Since  all  canonically  encoded  output  is an integral number of
  350.       octets, only the following cases can arise: (1) the final  quantum
  351.       of  encoding  input  is an integral multiple of 24 bits; here, the
  352.       final unit of encoded output will be an  integral  multiple  of  4
  353.       characters  with no "=" padding, (2) the final quantum of encoding
  354.       input is exactly 8 bits; here, the final unit  of  encoded  output
  355.       will  be two characters followed by two "=" padding characters, or
  356.       (3) the final quantum of encoding input is exactly 16 bits;  here,
  357.       the final unit of encoded output will be three characters followed
  358.       by one "=" padding character.
  359.  
  360.       Implementors should keep in mind that the  base  64  encodings  in
  361.       ADAT,  MIC,  and  ENC commands, and in 631 and 632 replies, may be
  362.       arbitrarily long.  Thus, the entire line must be  read  before  it
  363.       can be processed.  Several successive reads on the control channel
  364.       may be necessary.  It is not appropriate to for a server to reject
  365.       a  command  containing a base 64 encoding simply because it is too
  366.       long (assuming that the decoding is otherwise well formed  in  the
  367.       context in which it was sent).
  368.  
  369.       The server will return a 501 reply if the argument  could  not  be
  370.       properly base 64 decoded.
  371.  
  372.       The server will return a 535 reply to any MIC command which  fails
  373.       checksum, replay, sequencing, or other applicable security checks.
  374.  
  375.       There are no other direct replies from MIC or  ENC  commands;  the
  376.       resultant FTP command will generate its own replies.
  377.  
  378.       In environments where the native character set is not  ASCII,  the
  379.       client  must  translate  the  encapsulated command to ASCII before
  380.       passing  it  to  the  protection  routine,  and  the  server  must
  381.       translate  the  encapsulated  command from ASCII after passing the
  382.       token to the protection routine.
  383.  
  384.  
  385.    PRIVACY PROTECTED COMMAND (ENC)
  386.  
  387.       The argument field is a Telnet string  consisting  of  a  base  64
  388.       encoded  "private" message produced by an authentication mechanism
  389.       specific  message  confidentiality  procedure.   The  server  will
  390.       decode   the   received   string,   verify   its   integrity   and
  391.       confidentiality via the authentication mechanism specific  message
  392.       confidentiality   procedure,   and  upon  success,  interpret  the
  393.       resultant string as an FTP command.
  394.  
  395.       It is strongly recommended that PASS commands be  sent  under  ENC
  396.       protection, when possible.
  397.  
  398.       The server will return a 501 reply if the argument  could  not  be
  399.  
  400.  
  401.  
  402. Expires: October 31, 1993                                       [Page 7]
  403.  
  404. Internet-Draft          FTP Security Extensions               April 1993
  405.  
  406.  
  407.       properly base 64 decoded.
  408.  
  409.       The server will return a 535 reply to any ENC command which cannot
  410.       be  properly  decrypted, or fails checksum, replay, sequencing, or
  411.       other applicable security checks.
  412.  
  413.       The server will return a 402 reply if it does not support the  ENC
  414.       command.   In  this  case,  the  client  should retry the enclosed
  415.       command again under MIC protection.
  416.  
  417.  
  418.    DATA CHANNEL PROTECTION LEVEL (PROT)
  419.  
  420.       The argument is a single Telnet character code specifying the data
  421.       channel  protection  level.  The PROT command will be rejected and
  422.       the server will reply 504 if no previous ADAT  command  succeeded,
  423.       or the specified protection level is not supported.  Upon success,
  424.       a 200 reply will be sent by the server, indicating  that  the  new
  425.       protection level is now in effect.
  426.  
  427.       The following codes are assigned for protection levels:
  428.  
  429.  
  430.          C - Clear
  431.          S - Safe
  432.          P - Private
  433.  
  434.  
  435.       The default protection level  is  Safe,  unless  no  ADAT  command
  436.       succeeded,  in  which  case the default protection level is Clear.
  437.       Thus, when an ADAT command succeeds, the protection level  on  the
  438.       client  and  server  changes to Safe without the passing of a PROT
  439.       command.  The Safe protection level is required to be  implemented
  440.       by  all  authentication types, but the Private protection level is
  441.       optional.
  442.  
  443.       When using the Safe protection level, all data sent over the  data
  444.       channel  is  to  be integrity protected by cryptographic checksum.
  445.       When using the Private protection level, all data  sent  over  the
  446.       data channel is to be privacy protected by encryption.  The sender
  447.       will apply protection  services  after  all  data  transformations
  448.       associated  with  the current representation type, file structure,
  449.       and transfer mode have been performed.  The  data  sent  over  the
  450.       data  channel  is,  for  the  purposes  of  data protection, to be
  451.       treated as a byte stream.  An  authentication  mechanism  specific
  452.       data  protection  procedure  will  be  employed  by  the sender to
  453.       protect this byte stream.  The procedure should process  a  buffer
  454.       of  bytes  at  a  time,  and send the result as a stream of bytes,
  455.       prepending each transferred buffer with a four byte  length  field
  456.       (most  significant  byte first).  A minimal implementation must be
  457.  
  458.  
  459.  
  460. Expires: October 31, 1993                                       [Page 8]
  461.  
  462. Internet-Draft          FTP Security Extensions               April 1993
  463.  
  464.  
  465.       able to handle a buffer length of  at  least  65,536  bytes.   The
  466.       receiver  will read the four byte length field, and then read that
  467.       number of bytes of  protected  data,  passing  the  buffer  to  an
  468.       authentication   mechanism  specific  data  protection  procedure.
  469.       Further buffers will be similarly read  and  processed  until  all
  470.       bytes  are  sent.  Any transformations associated with the current
  471.       representation type, file structure, and transfer mode would  then
  472.       be  performed  on  the  resultant data.  When using block transfer
  473.       mode, the sender's (cleartext) buffer size should be equal to  the
  474.       block size.
  475.  
  476.       Under the Clear protection level (i.e., as  currently  defined  in
  477.       RFC  959),  and  when  in stream mode, the sender indicates end of
  478.       file  by  closing  the  data  connection.   This   is   inherently
  479.       unreliable,  since  the  receiver  cannot  determine  whether  the
  480.       connection was closed prematurely.  Transferring files  under  the
  481.       Safe  or  Private  protection  level allows the sender to convey a
  482.       positive indication of end of file by sending a  protected  buffer
  483.       which contains zero bytes of cleartext data.  Upon receipt of such
  484.       a zero length cleartext buffer, the  recipient  should  close  the
  485.       data  connection (without further reading from the connection) and
  486.       consider the file transfer complete.  If the connection is  closed
  487.       before such a buffer is received, then the file transfer should be
  488.       aborted, and the user should be alerted.  If the  server  was  the
  489.       recipient, then it should send a 535 reply in this case.
  490.  
  491.       If any data protection services  fail  at  any  time  during  data
  492.       transfer at the server end, the server will send a 535 reply.
  493.  
  494.  
  495. 4. New FTP Replies
  496.  
  497.    All replies after a successful ADAT command must be protected.  A new
  498.    reply type is introduced for this purpose, indicated by a sixth value
  499.    for the first digit of the reply code:
  500.  
  501.    6yz   Protected reply
  502.  
  503.       The text of this reply is to be decoded and interpreted as an  FTP
  504.       reply (if such decoding is successful).  If the reply code is 631,
  505.       then the text of the reply is  integrity  protected  in  the  same
  506.       manner  as  MIC commands.  If the reply code is 632, then the text
  507.       of the reply is privacy  protected  in  the  same  manner  as  ENC
  508.       commands.   All  replies  must  be  protected once an ADAT command
  509.       succeeds.  The server  may  send  a  protected  reply  only  if  a
  510.       previous  ADAT  command  succeeded.   The  security  policy of the
  511.       server will dictate when 631 or 632 replies are to be used.  As  a
  512.       general rule, the server should send a 631 reply to a MIC command,
  513.       and a 632 reply to an ENC command.
  514.  
  515.  
  516.  
  517.  
  518. Expires: October 31, 1993                                       [Page 9]
  519.  
  520. Internet-Draft          FTP Security Extensions               April 1993
  521.  
  522.  
  523.       The server must not send  632  replies  if  the  client  does  not
  524.       support  encryption  (this  should  be  indicated  by the security
  525.       context).  If, upon context establishment, it is not known whether
  526.       the  client  supports encryption, then the server must only send a
  527.       632 reply in response to an ENC command.
  528.  
  529.       Multi-line replies are handled as follows.  If the server sends  a
  530.       protected  reply  in  which  the  decoded reply has a hyphen ("-")
  531.       immediately following the reply code, then the  server  will  send
  532.       the  rest  of  the  lines  of  text  of  the multi-line reply each
  533.       protected and base 64 encoded as was  the  first  line,  and  each
  534.       followed  by  the  Telnet  end-of-line code.  The last line of the
  535.       multi-line reply will be that  line  which  when  decoded  by  the
  536.       receiver  begins  with the initial reply code followed by a space.
  537.       Note that it is the format of  the  decoded  reply,  and  not  the
  538.       enclosing  protected  reply, that indicates a multi-line reply.  A
  539.       hyphen immediately following a 6yz reply code should  be  ignored.
  540.       The server need not include the Telnet end-of-line code within the
  541.       encoded reply.
  542.  
  543.       If the server for some reason cannot encode the  reply,  then  the
  544.       unprotected  reply  will  be  sent  instead.   However, the client
  545.       should ignore the reply code of any cleartext reply sent after the
  546.       success of an ADAT command, and instead simply display the text of
  547.       the reply to the user.
  548.  
  549.  
  550. 5. Command Summary
  551.  
  552.    The following is a summary of the commands described above:
  553.  
  554.       AUTH <SP> <auth-type> <CRLF>
  555.       ADAT <SP> <base64string> <CRLF>
  556.       MIC  <SP> <base64string> <CRLF>
  557.       ENC  <SP> <base64string> <CRLF>
  558.       PROT <SP> <protection-level> <CRLF>
  559.  
  560.       The syntax of the above argument fields (using BNF notation where
  561.       applicable) is:
  562.  
  563.       <auth-type> ::= <string>
  564.       <string>    ::= <char> | <char><string>
  565.       <char>      ::= any of the 128 ASCII characters except <CR> and <LF>
  566.       <protection-level> ::= C | S | P
  567.       <base64string> ::= <quads> | <quads><terminal>
  568.       <quads> ::= <quad> | <quad><quads>
  569.       <quad> ::= <base64char><base64char><base64char><base64char>
  570.       <base64char> ::= ASCII A through Z
  571.                      | ASCII a through z
  572.                      | ASCII 0 through 9
  573.  
  574.  
  575.  
  576. Expires: October 31, 1993                                      [Page 10]
  577.  
  578. Internet-Draft          FTP Security Extensions               April 1993
  579.  
  580.  
  581.                      | ASCII +
  582.                      | ASCII /
  583.       <terminal>  ::= <base64char><terminal1><pad><pad>
  584.                     | <base64char><base64char><terminal2><pad>
  585.       <terminal1> ::= ASCII A through D
  586.       <terminal2> ::= ASCII A through P
  587.       <pad>       ::= ASCII =
  588.  
  589.  
  590.    The following lists the various reply codes for each new command:
  591.  
  592.    AUTH
  593.       234
  594.       334
  595.       500, 501, 503, 504, 421
  596.    ADAT
  597.       235
  598.       335
  599.       500, 501, 503, 535, 421
  600.    MIC
  601.       500, 501, 535, 421
  602.    ENC
  603.       402
  604.       500, 501, 535, 421
  605.    PROT
  606.       200
  607.       500, 501, 504, 421, 530
  608.  
  609.    The following are additional reply codes for existing  commands  (502
  610.    is  the  only  reply for all commands except ENC and MIC once an ADAT
  611.    command succeeds):
  612.  
  613.    USER
  614.       231
  615.       333
  616.    STOR
  617.       535
  618.    STOU
  619.       535
  620.    RETR
  621.       535
  622.    LIST
  623.       535
  624.    NLST
  625.       535
  626.    APPE
  627.       535
  628.  
  629.    The following is the syntax for protected replies:
  630.  
  631.  
  632.  
  633.  
  634. Expires: October 31, 1993                                      [Page 11]
  635.  
  636. Internet-Draft          FTP Security Extensions               April 1993
  637.  
  638.  
  639.    <code> <SP> <base64string> <CRLF>
  640.    <code> ::= 631 | 632
  641.  
  642.    Lines of the following form may follow in the case  of  a  multi-line
  643.    protected reply:
  644.  
  645.    <base64string> <CRLF>
  646.  
  647. 6. References
  648.  
  649.   [1] Reynolds, Joyce, and Postel, Jon, "File Transfer Protocol  (FTP)",
  650.       RFC 959, ISI, October 1985.
  651.  
  652.   [2] Linn, John, "Privacy Enhancement  for  Internet  Electronic  Mail:
  653.       Part  I:  Message  Encryption  and Authentication Procedures", RFC
  654.       1421, February 1993.
  655.  
  656.   [3] Linn, John, "Generic  Security  Service  API  (GSSAPI)",  Internet
  657.       Draft, November 1992.
  658.  
  659.   [4] Braden, R., "Requirements for Internet Hosts  --  Application  and
  660.       Support", RFC 1123, October 1989.
  661.  
  662.   [5]  Borman,  D.,  "Telnet  Authentication  and  Encryption   Option",
  663.       Internet Draft, Cray Research, Inc, April 1993.
  664.  
  665. Security Considerations
  666.  
  667.    Third party file transfers cannot be secured using these  extensions,
  668.    since  a  security  context cannot be established between two servers
  669.    using these facilities (no control connection exists  between  server
  670.    over  which  to  pass  ADAT  tokens).   Further  work in this area is
  671.    deferred.
  672.  
  673. APPENDIX I:  SPECIFICATION UNDER KERBEROS VERSION 4
  674.  
  675.    The authentication  type  (for  the  AUTH  command)  associated  with
  676.    Kerberos   Version   4   is  KERBEROS_V4.   If  the  server  supports
  677.    KERBEROS_V4, it will respond with a 334 reply code indicating that an
  678.    ADAT command is expected next.
  679.  
  680.    The client should  retrieve  a  ticket  for  the  Kerberos  principal
  681.    "ftp.hostname@realm"  by  calling krb_mk_req(3) with a principal name
  682.    of "ftp", an instance equal to the canonical host name of the  server
  683.    with all letters in lower case (as returned by krb_get_phost(3)), the
  684.    server's realm name  (as  returned  by  krb_realmofhost(3)),  and  an
  685.    arbitrary checksum.  The ticket must then be base 64 encoded and sent
  686.    as the argument to an ADAT command.
  687.  
  688.    The server must base 64 decode the argument to the ADAT  command  and
  689.  
  690.  
  691.  
  692. Expires: October 31, 1993                                      [Page 12]
  693.  
  694. Internet-Draft          FTP Security Extensions               April 1993
  695.  
  696.  
  697.    pass  the  result  to  krb_rd_req(3).  The server must add one to the
  698.    checksum from the authenticator and  sign  it  using  krb_mk_safe(3),
  699.    then  base 64 encode the result.  Upon success, the server must reply
  700.    to the client with a 235 code and include "ADAT=base64string" in  the
  701.    text of the reply.  Upon failure, the server will reply 535.
  702.  
  703.    Upon receipt of the 235 reply from the server, the client must  parse
  704.    the  text  of  the reply for the base 64 encoded data, decode it, and
  705.    pass the result to krb_rd_safe(3).  The client  should  consider  the
  706.    server  authenticated  if the resultant checksum is equal to one plus
  707.    the value previously sent.
  708.  
  709.    The procedure  associated  with  integrity  protected  MIC  commands,
  710.    replies, and Safe file transfers is:
  711.  
  712.       krb_mk_safe(3) for the sender
  713.       krb_rd_safe(3) for the receiver
  714.  
  715.    The  procedure  associated  with  privacy  protected  ENC   commands,
  716.    replies, and Private file transfers is:
  717.  
  718.       krb_mk_priv(3) for the sender
  719.       krb_rd_priv(3) for the receiver
  720.  
  721.    Note that this specification for KERBEROS_V4  contains  no  provision
  722.    for  negotiating  alternate  means  for integrity and confidentiality
  723.    routines.  Note also that the ADAT exchange does not  convey  whether
  724.    the peer supports confidentiality services.
  725.  
  726. APPENDIX II: SPECIFICATION UNDER THE GSSAPI
  727.  
  728.    The authentication type (for the AUTH command)  associated  with  all
  729.    mechanisms employing the GSSAPI is GSSAPI.  If the server supports an
  730.    authentication mechanism employing the GSSAPI, it will respond with a
  731.    334 reply code indicating that an ADAT command is expected next.
  732.  
  733.    The client  should  begin  the  authentication  exchange  by  calling
  734.    GSS_Init_Sec_Context, passing in NULL for claimant_cred_handle to get
  735.    the default credentials for the user (this is to  avoid  dependencies
  736.    on  names  for  particular  mechanisms),  0  for input_context_handle
  737.    (initially), NULL for mech_type (indicating  "use  default  mechanism
  738.    type"),  and  a  targ_name  equal to output_name from GSS_Import_Name
  739.    called  with  input_name_type  of  NULL  and   input_name_string   of
  740.    "SERVICE:ftp@hostname"  where  "hostname" is the fully qualified host
  741.    name of the server with all letters in lower case.  The  output_token
  742.    must  then  be base 64 encoded and sent to the server as the argument
  743.    to   an    ADAT    command.     If    GSS_Init_Sec_Context    returns
  744.    GSS_CONTINUE_NEEDED,  then  the  client  should  expect a token to be
  745.    returned in the  reply  to  the  ADAT  command.   This  token  should
  746.    subsequently  be  passed to another call to GSS_Init_Sec_Context.  In
  747.  
  748.  
  749.  
  750. Expires: October 31, 1993                                      [Page 13]
  751.  
  752. Internet-Draft          FTP Security Extensions               April 1993
  753.  
  754.  
  755.    this case, if GSS_Init_Sec_Context returns no output_token, then  the
  756.    reply  code from the server for the previous ADAT command should have
  757.    been 235.  If  GSS_Init_Sec_Context  returns  GSS_COMPLETE,  then  no
  758.    further  tokens  should  be  expected from the server, and the client
  759.    should consider the server authenticated.
  760.  
  761.    The server must base 64 decode the argument to the ADAT  command  and
  762.    pass  the  resultant  token to GSS_Accept_Sec_Context as input_token,
  763.    setting acceptor_cred_handle to NULL (for "use default credentials"),
  764.    and  0  for  input_context_handle (initially).  If an output_token is
  765.    returned, it should be base 64 encoded and returned to the client  by
  766.    including   "ADAT=base64string"   in  the  text  of  the  reply.   If
  767.    GSS_Accept_Sec_Context returns GSS_COMPLETE, the reply code should be
  768.    235,  and  the  server  should consider the client authenticated.  If
  769.    GSS_Accept_Sec_Context returns GSS_CONTINUE_NEEDED,  the  reply  code
  770.    should be 335.  Otherwise, the reply code should be 535, and the text
  771.    of the reply should contain a descriptive error message.
  772.  
  773.    The procedure  associated  with  integrity  protected  MIC  commands,
  774.    replies, and Safe file transfers is:
  775.  
  776.       GSS_Safe for the sender
  777.       GSS_Verify for the receiver
  778.  
  779.    The  procedure  associated  with  privacy  protected  ENC   commands,
  780.    replies, and Private file transfers is:
  781.  
  782.       GSS_Seal for the sender
  783.       GSS_Unseal for the receiver
  784.  
  785.    Both the client and server should inspect the value of conf_avail  to
  786.    determine whether the peer supports confidentiality services.
  787.  
  788. Author's Address:
  789.  
  790.    Steven J. Lunt
  791.    Bellcore
  792.    RRC-1L213
  793.    444 Hoes Lane
  794.    Piscataway, NJ 08854
  795.  
  796.    Phone: (908) 699-4244
  797.    EMail: lunt@bellcore.com
  798.  
  799.    Mailing List: ftp-wg@tgv.com
  800.  
  801. Chair's Address:
  802.  
  803.    The working group can be contacted via the current chair:
  804.  
  805.  
  806.  
  807.  
  808. Expires: October 31, 1993                                      [Page 14]
  809.  
  810. Internet-Draft          FTP Security Extensions               April 1993
  811.  
  812.  
  813.    Sam Sjogren
  814.    TGV, Inc.
  815.    603 Mission St.
  816.    Santa Cruz, CA  95060
  817.  
  818.    Phone: (408) 427-4366
  819.    EMail: sjogren@tgv.com
  820.  
  821. Author's Notes:
  822.  
  823.    This is implemented and working for Kerberos V4 on SunOS 4.1.2  using
  824.    SunOS  source  for ftp and ftpd, and also the BSD Reno source for ftp
  825.    and ftpd.
  826.  
  827.    YET TO BE DONE:
  828.  
  829.  
  830.      1.  Determine a suitably general targ_name for GSSAPI.
  831.  
  832.      2.  Implementation using GSSAPI.
  833.  
  834.      3.  The client may fail when processing the ADAT data  from  a  235
  835.          reply,  in  which case the server thinks things are OK, but the
  836.          client thinks otherwise.  Unclear how to proceed at that point,
  837.          other than to drop the connection.
  838.  
  839.      4.  New state diagrams might need to be drawn  for  how  the  AUTH,
  840.          ADAT, USER, and PASS commands now flow.
  841.  
  842.      5.  It would be desirable to make use  of  the  rcmd  principal  in
  843.          Kerberos  V4,  but there may be some environments where the ftp
  844.          server needs to run in a chroot'ed environment.  Thus, the  ftp
  845.          principal  was specified.  There should be some way to make use
  846.          of the rcmd principal if there  is  no  ftp  principal  at  the
  847.          server site.
  848.  
  849.  
  850.  
  851.  
  852.  
  853.  
  854.  
  855.  
  856.  
  857.  
  858.  
  859.  
  860.  
  861.  
  862.  
  863.  
  864.  
  865.  
  866. Expires: October 31, 1993                                      [Page 15]
  867.  
  868.  
  869.  
  870.